package cn.jinzhu.consumer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@EnableEurekaClient
@SpringBootApplication
public class ConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }
    @Bean
    RestTemplate restTemplateOne(){
        return  new RestTemplate();
    }

    @Bean
    @LoadBalanced //注解的方式开启客户端负载均衡，因为一个提供者有多个端口需要均衡代理
    RestTemplate restTemplate(){
        return  new RestTemplate();
    }
}
